package com.cci.kangdao.dao;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.mybatis.spring.annotation.MapperScan;

import java.util.List;
import java.util.Map;

/**
 * 用户表类dao
 */
@MapperScan
public interface UserGroupSubTDao {

    //根据服务站id获取服务站站长信息(可能多个)
    @Select("select * from UsergroupSub_T sug\n" +
            "  inner join Usergroup_T ug on sug.UsergroupID = ug.ID and sug.Flag = 0 and ug.Flag = 0\n" +
            "  inner join CompanyUserGroupRelation_T cugr on cugr.UserGroupId = ug.ID and cugr.Flag = 0\n" +
            "where cugr.CompanyId = #{companyId} and cugr.UserGroupType = #{userGroupType}")
    List<Map<String, Object>> getSubUserGroupByCompanyId(@Param("companyId") Long companyId, @Param("userGroupType") Integer userGroupType);

    @Select("select GroupName from UsergroupSub_T where Flag = 0  and ID = #{subUserGroupId}")
    String getSubUserGroupNameById(Long subUserGroupId);
}
